package org.tloss.web.editor.model.oper.math;

import javax.xml.bind.annotation.XmlElement;

import org.tloss.web.editor.database.editors.jdbc.Column;
import org.tloss.web.editor.database.editors.jdbc.Table;
import org.tloss.web.editor.utils.Constants;

public class ColumnOperand extends MathOperand {
	private Table table;
	private Column column;

	@XmlElement
	public Table getTable() {
		return table;
	}

	public void setTable(Table table) {
		this.table = table;
	}

	@XmlElement
	public Column getColumn() {
		return column;
	}

	public void setColumn(Column column) {
		this.column = column;
	}

	@Override
	public String getDisplayText() {

		return "" + table.getTableName() + "." + column.getColumnName();
	}

	@Override
	public String generate(int type, Object[] param) {
		if (type == Constants.CodeType.SQL) {
			return getDisplayText();
		}
		return null;
	}

	@Override
	public String getType() {
		return "NONE";
	}

}
